<template>
  <div>
    <el-carousel trigger="click"
                 :interval="2000"
                 height="30vw">
      <el-carousel-item v-for="item in imgArray"
                        :key="item.key">
        <a target="_blank"
           href="/">
          <img :src="item.imageUrl"
               style="width:100%;height: 100%;"
               alt="首页banner">
        </a>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import banner from '~/utils/api/banner'
export default {
  data() {
    return {
      imgArray: []
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      banner.getList().then(response => {
        this.imgArray = response.data.data.list
      })
    }
  }
}
</script>

<style>
</style>